package com.supreme.commonboot.component;

import com.supreme.common.constant.ConsoleColors;
import com.supreme.commonboot.annotation.ApplicationName;
import com.supreme.commonboot.condition.RunnerEventCondition;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.Conditional;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
@Conditional(value = {RunnerEventCondition.class})
public class BootCommandLineRunner implements CommandLineRunner {

    @ApplicationName
    private String applicationName;

    @Override
    public void run(String... args) throws Exception {
        ConsoleColors.printf(ConsoleColors.GREEN_BOLD_BRIGHT, "BootCommandLineRunner = %s args = %s\n", applicationName, Arrays.toString(args));
    }
}
